package controller.menubar.commands;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import view.MainFrame;

public class Move implements ActionListener {
	
	public Move(MainFrame frame) {			
		this.frame = frame;			
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		final File from =  frame.getMainPanel().getPrimary().getDiskContent().getSelectedFile();						
		final File to = frame.getMainPanel().getSecondary().getDiskContent().getActualFile();		
		
		final String newFile = to.getAbsolutePath() + File.separator + from.getName() ;
		
		Runnable task = new Runnable()
        {   
            @Override
            public void run()
            {
                new FileCopierUtility(frame,from,new File(newFile),false).setVisible(true);
            }
        };
        task.run();
		
	}
	
	private MainFrame frame;
}